/// <reference path="declare.ts"/>

import websiteConfig = require("json!websiteConfig");

/** 站点路径 */
export function stationPath(path: string) {
    console.assert(requirejs != null);
    let contexts = requirejs.exec("contexts");
    let contextName: string;
    if (websiteConfig.requirejs)
        contextName = websiteConfig.requirejs.context;

    let context: RequireContext = contexts[contextName];
    if (context != null && context.config != null && context.config.baseUrl != null) {
        return `${context.config.baseUrl}${path}`;
    }
    return `${path}`;
}